package com.usian.controller;

import com.usian.feign.UserFeign;
import com.usian.pojo.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.client.ServiceInstance;
import org.springframework.cloud.client.loadbalancer.LoadBalancerClient;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

@RestController
public class UserController {
    @Autowired
    private UserFeign userFeign;

    @RequestMapping("/findById/{id}")
    public String findById(@PathVariable Integer id){
        User user = userFeign.findById(id);
        return user.toString();
    }
    @RequestMapping("/findByName/{name}")
    public String findByName(@PathVariable String name){
        User user = userFeign.findByName(name);
        return user.toString();
    }
    @RequestMapping("/findByUser/{user}")
    public String findByUser(@PathVariable User user){
        User user1 = userFeign.findByUser(user);
        return user1.toString();
    }

}
